<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css onmousedown onmouseup onclick</title>
</head>
<body>

    <div onmousedown="mDown(this)" onmouseup="mUp(this)" onclick="mClick(this)"
         style="background-color:green;color:#ffffff;width:90px;height:20px;padding:40px;font-size:12px;">
        请点击这里
    </div>

    <script type="text/javascript">
        function mDown(obj) {
            obj.style.backgroundColor = "#ff0000";
            obj.innerHTML="请释放鼠标按钮"
        }

        function mClick() {
            obj.style.backgroundColor = "#0000ff";
        }

        function mUp(obj) {
            obj.style.backgroundColor = "#00ff00";
            obj.innerHTML="请按下鼠标按钮"
        }

    </script>
</body>
</html>